Skip to content

Conversation

@alexarchambault
Copy link
Collaborator

@alexarchambault alexarchambault commented Oct 3, 2025

This changes how Mill is run in integration tests and examples. This makes it stop publishing things under ~/.ivy2/local, and use something like out/dist/localRepo.dest instead, which is the Task.dest of the new dist.localRepo task. That new repository is a local Maven repositiory rather than an Ivy one, which has a slightly different file structure, the same as Maven Central.

For that new repository to be taken into account, the Mill launcher used in examples and ITs is now a script (bat under Windows, bash everywhere else) that sets the COURSIER_REPOSITORIES env var, so that the new local repo is added to it, and gets automatically used when running examples and ITs.

The second commit of this PR mainly updates the file names of the locally published Mill artifacts, because of the switch from an Ivy repository to a Maven one.

That's been useful to me when using a locally published Mill version, to develop on Mill or other projects. Running examples or ITs erases it, which is annoying, but also somewhat unexpected (running tests shouldn't erase things in the local repository, at least not things put there manually on purpose). This PR fixes that.

@lihaoyi
Copy link
Member

lihaoyi commented Oct 3, 2025

What's the benefit of making these changes?

@alexarchambault
Copy link
Collaborator Author

What's the benefit of making these changes?

Sorry, forgot to mention that in the PR description. That's been useful to me when using a locally published Mill version, to develop on Mill or other projects. Running examples or ITs erases it, which is annoying, but also somewhat unexpected (running tests shouldn't erase things in the local repository, at least not things put there manually on purpose).

 Conflicts:
	integration/ide/build-classpath-contents/src/BuildClasspathContentsTests.scala
	integration/ide/gen-idea/resources/extended/idea/mill_modules/mill-build.iml
	integration/ide/gen-idea/resources/extended/idea/mill_modules/mill-build.mill-build.iml
	integration/ide/gen-idea/resources/hello-idea/idea/mill_modules/mill-build.iml
@alexarchambault alexarchambault requested a review from lefou October 13, 2025 10:42
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. But doesn't this make some tests sensitive to env variable MILL_STABLE_VERSION being not 1?

@alexarchambault
Copy link
Collaborator Author

@lefou What do you mean? It makes them sensitive to the Mill version not being SNAPSHOT for sure.

@lefou
Copy link
Member

lefou commented Oct 16, 2025

@lefou What do you mean? It makes them sensitive to the Mill version not being SNAPSHOT for sure.

Yeah. I mean, it would be nice if the test suite still works in a release build. But a release build will most likely not have the version SNAPSHOT.

@lefou
Copy link
Member

lefou commented Oct 17, 2025

To make it clear, I really support the idea of using a local repo instead of ~/.ivy2/local. Out of curiosity, was the choice to switch to a local Maven repository necessary for technical reasons, or is it just the more conventioal repository format? I'm asking, since using a local ivy repo would most likely avoid the issue of integration tests not working with a non-SNAPSHOT version. But maybe, we can find another solution, e.g. replace the version string in the golden literals.

 Conflicts:
	integration/ide/gen-idea/resources/extended/idea/mill_modules/mill-build.iml
	integration/ide/gen-idea/resources/extended/idea/mill_modules/mill-build.mill-build.iml
	integration/ide/gen-idea/resources/hello-idea/idea/mill_modules/mill-build.iml
@alexarchambault alexarchambault merged commit 2beb6c1 into com-lihaoyi:main Oct 29, 2025
60 of 63 checks passed
@alexarchambault alexarchambault deleted the local-repo-in-build branch October 29, 2025 21:58
@lefou lefou added this to the after 1.0.6 milestone Oct 30, 2025
lihaoyi added a commit to lihaoyi/mill-1 that referenced this pull request Oct 31, 2025
lihaoyi added a commit that referenced this pull request Oct 31, 2025
…ocal (#5949)" (#6067)

This reverts commit 2beb6c1, as it
seems to break `./mill dist.installLocalCache`

Presumably an unexpected interaction, but reverting it for now so that
local testing and development isn't blocked

Seems like it causes IntelliJ BSP installation of `installLocalCache`
output to fail

```
Executing /Users/lihaoyi/test/mill -i mill.bsp.BSP/install
Mill is running in BSP mode, using a separate output directory 'out/mill-bsp-out'. If you would like to reuse the regular `out/` directory, set the 'MILL_NO_SEPARATE_BSP_OUTPUT_DIR' environment variable. This will reduce the CPU usage of the BSP server but make it less responsive.
Downloading https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom
Failed to download https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom
Downloading https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom.sha1
Failed to download https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom.sha1
Exception in thread "main" java.lang.RuntimeException: coursier.error.ResolutionError$CantDownloadModule: Error downloading com.lihaoyi:mill-runner-daemon_3:1.0.6-89-6adfd5-DIRTYc23995aa
  not found: /Users/lihaoyi/.ivy2/local/com.lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/ivys/ivy.xml
  not found: https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom
	at scala.sys.package$.error(package.scala:27)
	at mill.launcher.CoursierClient$.resolveMillDaemon(CoursierClient.scala:42)
	at mill.launcher.CoursierClient.resolveMillDaemon(CoursierClient.scala)
	at mill.launcher.MillLauncherMain.lambda$main$4(MillLauncherMain.java:79)
	at mill.launcher.MillProcessLauncher.cachedComputedValue0(MillProcessLauncher.java:270)
	at mill.launcher.MillLauncherMain.main(MillLauncherMain.java:75)
```
CC @alexarchambault
alexarchambault added a commit to alexarchambault/mill that referenced this pull request Oct 31, 2025
lihaoyi pushed a commit that referenced this pull request Oct 31, 2025
)

This changes how Mill is run in integration tests and examples. This
makes it stop publishing things under `~/.ivy2/local`, and use something
like `out/dist/localRepo.dest` instead, which is the `Task.dest` of the
new `dist.localRepo` task. That new repository is a local Maven
repositiory rather than an Ivy one, which has a slightly different file
structure, the same as Maven Central.

For that new repository to be taken into account, the Mill launcher used
in examples and ITs is now a script (bat under Windows, bash everywhere
else) that sets the `COURSIER_REPOSITORIES` env var, so that the new
local repo is added to it, and gets automatically used when running
examples and ITs.

The second commit of this PR mainly updates the file names of the
locally published Mill artifacts, because of the switch from an Ivy
repository to a Maven one.

That's been useful to me when using a locally published Mill version, to
develop on Mill or other projects. Running examples or ITs erases it,
which is annoying, but also somewhat unexpected (running tests shouldn't
erase things in the local repository, at least not things put there
manually on purpose). This PR fixes that.

---

This adds back #5949 that was
reverted in #6067, and changes
`dist.installLocalCache`, so that it publishes things under
`~/.ivy2/local` like `dist.installLocal` does (rather than using the
local repo under `out/`, which is more likely to go away).
@lefou lefou changed the title Run examples with local repo under out/ rather than ~/.ivy2/local Run examples with local repo under out/ rather than ~/.ivy2/local (reverted) Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants